package pers.xuyong.strive.datastruct.mode.factory;

import pers.xuyong.strive.datastruct.mode.factory.product.AbstractHuman;
import pers.xuyong.strive.datastruct.mode.factory.product.BlackHuman;
import pers.xuyong.strive.datastruct.mode.factory.product.WhiteHuman;
import pers.xuyong.strive.datastruct.mode.factory.product.YellowHuman;

/**
 *  主入口
 *
 * @author billymac
 * @version 1.0
 * @date 17/6/28  下午11:04
 * @since JDK1.8
 */
public class FactoryMain {

    public static void main(String[] args) {
        /**
         * 工厂模式
         */
        AbstractHumanFactory factory = new NvWa();
        AbstractHuman blackHuman = factory.createHuman(BlackHuman.class);
        blackHuman.getColor();
        blackHuman.talk();

        AbstractHuman whiteHuman = factory.createHuman(WhiteHuman.class);
        whiteHuman.getColor();
        whiteHuman.talk();

        AbstractHuman yellowHuman = factory.createHuman(YellowHuman.class);
        yellowHuman.getColor();
        yellowHuman.talk();

    }
}
